package com.gem.day08.factory;

/**简单工厂*/
public class SimpleFactory {

	public static final int AMERICANO = 1;
	public static final int CAPPUCCINO = 2;
	public static final int LATTE = 3;

	public static Coffee getCoffee(int type) {
		Coffee coffee = null;
		if (type == AMERICANO) {
			coffee = new Americano();
		} else if (type == CAPPUCCINO) {
			coffee = new Cappuccino();
		} else if (type == LATTE) {
			coffee = new Latte();
		} else {
			throw new RuntimeException("参数不合法!");
		}
		return coffee;
	}
}
